package com.pinda.service.impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pinda.base.entity.PdFleet;
import com.pinda.base.search.PdFleetSearch;
import com.pinda.base.vo.FleetVo;
import com.pinda.commonutils.Page;
import com.pinda.mapper.PdFleetMapper;
import com.pinda.service.IPdFleetService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 车队表 服务实现类
 * </p>
 *
 * @author lc
 * @since 2023-06-14
 */
@Service
public class PdFleetServiceImpl extends ServiceImpl<PdFleetMapper, PdFleet> implements IPdFleetService {
    @Resource
    PdFleetMapper pdFleetMapper;


    /**
     * 分页条件查询
     * @param page
     * @return
     */
    @Override
    public PageInfo<FleetVo> findFleetByName(Page<PdFleetSearch> page) {
        PageHelper.startPage(page.getPageNum(), page.getPageSize());
        List<FleetVo> fleetByName = pdFleetMapper.findFleetByName(page.getSearch());
        return new PageInfo(fleetByName);
    }

    /**
     * 减去车队的人数
     * @param id
     */
    @Override
    public void updateFleetNumberMinus(String id) {
        this.pdFleetMapper.updateFleetNumberMinus(id);
    }

    @Override
    public void updateFleetNumberadd(String fleetId) {
        this.pdFleetMapper.updateFleetNumberadd(fleetId);
    }

    @Override
    public PdFleet selectFleet(String fleetId) {
        return pdFleetMapper.selectById(fleetId);
    }


}
